#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> arr(n);
  for (auto &x : arr) scanf("%d", &x);
  while (m--) {
    int x;
    scanf("%d", &x);
    auto iter = ranges::lower_bound(arr, x);
    if (iter != arr.end() && *iter == x) {
      // found;
      cout << (iter - arr.begin() + 1) << ' ';
    } else {
      cout << -1 << ' ';
    }
  }
  cout << endl;
}